/*
 *  mih_net_sap.h
 *  MIHF
 *
 *  Created by injae song on 11. 3. 5..
 *  Copyright 2011 KyungHee Univ. All rights reserved.
 *
 */
#ifndef MIH_NET_SAP
#define MIH_NET_SAP

#include "mihf.h"
#include "mih_type.h"
#include "mih_protocol.h"
#include "list.h"

#define MIH_NET_SAP_PORT 3285  /* port for MIH_USER */
#define MAX_LISTEN 10



int init_mih_net_sap(mihf* mih, server_type type);

void mih_net_connection_read_handler(struct bufferevent *bev, void *arg);

void mih_net_connection_write_handler(struct bufferevent *bev, void *arg);

void mih_net_connection_close_after_write_handler(struct bufferevent *bev, void *arg);

void mih_net_connection_error_handler(struct bufferevent *bev, short what, void *arg);

void mih_net_connection_accept(int fd, short event, void *arg);

void mih_net_send(char *addr, int port, char *msg, int size, mihf *);

int mih_connect(char *addr, int port);

//void free_mih_net_connection(mihf *mih, int fd);

#endif